/*
Filter Panel
===========================================
Defines the styling of the filter panel element.

The styling includes the collapsed and expanded styling and the panel component properties.
```
<div class="filter-panel">
	<div class="filter-panel--flyout">

		<label class="filter-panel--title">
		Preis
		</label>

		<span class="filter-panel--icon"></span>

		<div class="filter-panel--content">
		test test
		</div>

	</div>
</div>
```
*/
.filter-panel {
    .unitize-height(38);
    .unitize(margin-bottom, 10);
    .border-radius();
    .white-gradient();
    .user-select(none);
    .touch-callout(none);
    .tap-highlight-color(rgba(0, 0, 0, 0));
    display: block;
    position: relative;
    border: 1px solid @border-color;

    &:hover {
        border: 1px solid @brand-primary;
        background: #FFF;

        .filter-panel--icon,
        .filter-panel--title {
            color: @brand-primary;
        }
    }

    &.is--disabled {
        .white-gradient();
        opacity: 0.5;
        border: 1px solid @border-color;
        color: @text-color;

        &:hover {
            border: 1px solid @border-color;
            color: @text-color;

            .filter-panel--icon,
            .filter-panel--title {
                color: @text-color;
            }
        }

        .filter-panel--title {
            color: @text-color;
        }
    }

    &.is--collapsed {
        height: auto;
        border: 0 none;

        .filter-panel--flyout {
            height: auto;
            border: 1px solid @brand-primary;
            background: #FFF;
            overflow: visible;
            z-index: @zindex-filter-panel-flyout-collapsed;
        }

        .filter-panel--title {
            color: @brand-primary;
        }

        .filter-panel--icon:before {
            color: @brand-primary;
            content: @sw-icon-arrow-up;
        }
    }

    .flatpickr-wrapper {
        position: relative;
        display: block;

        .flatpickr-calendar.static {
            .unitize(top, 45);
            display: block;
            width: 100%;

            .flatpickr-rContainer {
                display: block;
            }

            .flatpickr-innerContainer {
                display: block;
                width: 100%;

                .flatpickr-days {
                    width: 100%;
                }
            }
        }
    }
}

.filter-panel--flyout {
    .unitize-height(38);
    .border-radius();
    display: block;
    width: 100%;
    overflow: hidden;
    z-index: @zindex-filter-panel-flyout;
}

.filter-panel--title {
    .unitize-height(36);
    .unitize(line-height, 36);
    .unitize-padding(0, 30, 0, 10);
    .unitize-margin(0, 0, 5, 0);
    .user-select(none);
    .touch-callout(none);
    .tap-highlight-color(rgba(0, 0, 0, 0));
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.filter-panel--icon {
    .unitize-width(16);
    .unitize-height(16);
    .unitize(top, 8);
    .unitize(right, 10);
    .unitize(font-size, 6);
    .unitize(line-height, 16);
    .user-select(none);
    .touch-callout(none);
    .tap-highlight-color(rgba(0, 0, 0, 0));
    display: inline-block;
    position: absolute;
    font-family: @sw-icon-fontname;
    text-align: center;
    cursor: pointer;
    pointer-events: none;

    &:before {
        content: @sw-icon-arrow-down;
    }
}

.filter-panel--content {
    .unitize-padding(10, 10);
    display: block;


}

.filter-panel--option-list {
    .unitize(padding-bottom, 5);
    list-style: none;

    &.sub-level {
        .unitize-margin(0, 0, 0, 8);
        .unitize-padding(0, 0, 0, 18);
        border-left: 1px solid @border-color;
    }
}

.filter-panel--option {
    display: block;
    position: relative;
}

.value-tree--option {
    .unitize-margin(0, 0, 10, 0);

    .sub-level & {
        margin: 0;
    }
}

.filter-panel--label {
    .unitize-padding(4, 0, 4, 30);
    .unitize(line-height, 18);
    .user-select(none);
    .touch-callout(none);
    .tap-highlight-color(rgba(0, 0, 0, 0));
    display: block;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-panel--range-info {
    .unitize-padding(10, 0, 5, 0);
    text-align: center;

    .range-info--label {
        color: @text-color-dark;
        font-weight: @font-bold-weight;
    }
}

.filter--date {
    .input-type--date {
        .filter-panel--input {
            display: block;
            width: 100%;
        }
    }
}

.filter-panel--checkbox,
.filter-panel--radio {
    .unitize-width(16);
    .unitize-height(16);
    .unitize-padding(1, 1);
    .border-radius();
    display: inline-block;
    border: 1px solid @border-color;
    cursor: pointer;
    position: relative;
    vertical-align: top;

    &:hover {
        border-color: @brand-primary;
    }

    input[type="checkbox"] {
        .opacity(0);
        display: block;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        border: 0 none;
        background: none;
        cursor: pointer;
        z-index: @zindex-filter-panel-checkbox;

        &:checked ~ .input--state,
        &:checked ~ .checkbox--state {
            .primary-gradient();

            &:before {
                .unitize-width(12);
                .unitize-height(12);
                .unitize(line-height, 12);
                .unitize(font-size, 7);
                display: block;
                font-family: @sw-icon-fontname;
                font-weight: @font-base-weight;
                text-align: center;
                color: #fff;
                content: @sw-icon-check;
            }
        }

        &:checked ~ .filter-panel--label {
            color: @brand-primary;
            font-weight: @font-bold-weight;
        }

        &:disabled ~ .input--state,
        &:disabled ~ .checkbox--state {
            background: @body-bg;
        }

        &:disabled ~ .filter-panel--label {
            color: lighten(@text-color, 15%);
        }
    }

    .input--state,
    .checkbox--state,
    .radio--state {
        .border-radius();
        display: block;
        width: 100%;
        height: 100%;
        position: relative;
        z-index: @zindex-filter-panel-checkbox-state;
    }

    &.filter-panel--radio {
        .border-radius(11px);
    }

    input[type="radio"] {
        .opacity(0);
        display: block;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        border: 0 none;
        background: none;
        cursor: pointer;
        z-index: @zindex-filter-panel-radio;

        &:checked ~ .input--state,
        &:checked ~ .radio--state {
            .primary-gradient();
        }

        &:checked ~ .filter-panel--label {
            color: @brand-primary;
            font-weight: @font-bold-weight;
        }

        &:disabled .input--state,
        &:disabled .radio--state {
            background: @body-bg;
        }

        &:disabled .filter-panel--label {
            color: @text-color;
        }

        & + .input--state,
        & + .radio--state {
            .border-radius(11px);
        }
    }
}

.input-type--media {
    .clearfix();
}

.input-type--media .option--container {
    .unitize-height(45);
    .unitize(max-width, 45);
    width: 18%;
    margin: 0 0 2% 2%;
    display: block;
    position: relative;
    float: left;

    .filter-panel--label {
        padding: 0;
    }

    input.is--disabled ~ label {
        opacity: 0.2;
    }

    input[type="checkbox"],
    input[type="radio"] {
        .opacity(0);
        display: block;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        border: 0 none;
        background: none;
        cursor: pointer;
        z-index: @zindex-filter-panel-media-checkbox;

        &:hover ~ .filter-panel--label {
            border-color: @brand-primary;
        }

        &:checked ~ .filter-panel--label {
            border-color: @brand-primary;

            &:after {
                .unitize-width(16);
                .unitize-height(16);
                .unitize(line-height, 16);
                .unitize(font-size, 7);
                .unitize(-4, 16, top);
                .unitize(-4, 16, right);
                .primary-gradient();
                .border-radius(8px);
                display: block;
                position: absolute;
                font-family: @sw-icon-fontname;
                font-weight: @font-base-weight;
                text-align: center;
                color: #fff;
                content: @sw-icon-check;
            }
        }

        &:disabled .filter-panel--label {
            .opacity(0.2);
        }
    }
}

.filter--multi-selection,
.filter--value,
.filter--value-tree {

    .option--container:hover {
        .filter-panel--label {
            color: @brand-primary;
        }
        .filter-panel--input {
            border-color: @brand-primary;
        }
    }

    .option--container:hover {
        .filter-panel--input.is--disabled {
            border-color: @border-color;
        }
    }

    .filter-panel--checkbox,
    .filter-panel--radio {
        .unitize(top, 5);
        .unitize(left, 0);
        position: absolute;

        &.is--disabled {
            & ~ .filter-panel--label {
                color: @gray-dark;
            }

            &:hover {
                border-color: @border-color;
            }
        }
    }
}

.filter-panel--star-rating {
    .clearfix();
    .unitize-height(90);
    .unitize(margin-bottom, 10);
    position: relative;

    .rating-star--outer-container {
        .clearfix();
        .unitize-width(220);
        margin-left: auto;
        margin-right: auto;
        cursor: pointer;

        .icon--star, .icon--star-empty {
            .unitize(font-size, 18);
        }

        .icon--star {
            color: @rating-star-color;
        }
        .icon--star-empty {
            .transition();
            color: @gray-dark;
        }

        .rating-star--suffix {
            .unitize(margin-left, 5);
            .transition();
        }

        &.is--active {
            .icon--star-empty {
                color: @text-color;
            }
            .rating-star--suffix {
                font-weight: @font-bold-weight;
            }
        }

        &.is--disabled {
            opacity: 0.3;
        }

        &:hover .icon--star-empty {
            color: @text-color;
        }

        &:hover .rating-star--suffix {
            color: @brand-primary;
        }

        &:hover .is--disabled {
            ~ .icon--star-empty {
                .transition();
                color: @gray-dark;
            }

            ~ .rating-star--suffix {
                color: @text-color;
            }
        }
    }
}

.filter--set-title {
    .unitize-margin(30, 0, 10, 0);
    .unitize(font-size, 14);
    .unitize(line-height, 24);
    margin-left: 1%;
    margin-right: 1%;
    border-bottom: 1px solid @border-color;
    clear: both;
}

.filter--value {
    background: #fff;

    .filter-panel--input {
        .unitize(top, 10);
        .unitize(left, 10);
    }

    .filter-panel--title {
        .unitize-padding(0, 30, 0, 40);
    }

    &.is--disabled .filter-panel--input:hover {
        border-color: @border-color;
    }
}

.filter--range {
    .filter-panel--content {
        .unitize-padding(10, 20);
    }
}

.filter--active-container {
    .unitize-padding(20, 0, 0, 0);
}

.filter--active {
    .unitize-padding(0, 10);
    .unitize-margin(0, 10, 10, 0);
    .unitize(line-height, 24);
    .unitize(font-size, 13);
    .border-radius();
    display: inline-block;
    border: 1px solid @border-color;
    color: @text-color;
    background: #FFF;
    cursor: pointer;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;

    .filter--active-icon {
        .unitize-margin(0, 10, 0, 0);
        .unitize(font-size, 8);
        .unitize(-1, 16, top);
        position: relative;
        font-family: @sw-icon-fontname;
        color: @text-color;

        &:before {
            content: @sw-icon-cross;
        }
    }

    .icon--star {
        color: @rating-star-color;
    }

    .icon--star-empty {
        color: @text-color;
    }

    &:hover,
    &[data-filter-param="reset"] {
        color: @brand-primary;
        border-color: @brand-primary;

        .filter--active-icon {
            color: @brand-primary;
        }
    }
}

.action--filter-options.off-canvas.is--open .filter--active {
    max-width: 100%;
}

.filter--actions {
    .unitize-padding(10, 0);
    .unitize(margin-bottom, 10);
    clear: both;
}

.filter--btn-apply {
    position: relative;
    font-weight: @font-bold-weight;
    width: 100%;

    &.is--icon-right [class^="icon--"] {
        .unitize(font-size, 14);
        .unitize(line-height, 16);
        .unitize-margin(-8, 0, 0, 0);
    }

    &.is--loading {
        [class^="icon--"] {
            .animation(keyframe--spin-reverse 1s linear infinite);
        }
    }

    .filter--count {
        font-weight: @font-bold-weight;
    }
}

.filter--facet-container {
    .clearfix();
    .unitize-padding(10, 0, 0, 0);
}

.action--filter-options.is--active-filter {
    .filter--active-container {
        .unitize-padding(15, 0, 5, 0);
        display: block;
    }
}

.filter--active-container {
    display: none;
}

.listing--wrapper {
    width: 100%;

    &.has--sidebar-filter {
        .listing--paging {
            clear: both;
        }

        .action--filter-btn {
            display: block;
        }

        .action--sort {
            .unitize(line-height, 32);
            .unitize-margin(0, 10, 10, 0);
            width: 100%;

            .sort--label {
                display: none;
            }

            .sort--select {
                width: 100%;
                vertical-align: top;
            }
        }
    }

    .filter--actions.filter--actions-top {
        margin: 0;
    }
}

@media screen and(min-width: @tabletViewportWidth) {

    .filter-panel {
        width: 49%;
        margin-left: 1%;
        float: left;

        &.is--collapsed {
            .unitize-height(38);
        }

        .flatpickr-wrapper {
            position: static;

            .flatpickr-calendar.static {
                top: 100%;
            }
        }
    }

    .is--no-sidebar .filter-panel {
        width: 32%;
    }

    .filter-panel--flyout {
        position: absolute;
        top: 0;
        left: 0;
    }

    .filter-panel--content {
        .unitize-max-height(200);
        overflow-x: hidden;
        overflow-y: auto;
    }

    .filter--active-container {
        padding: 0;
        margin-left: 1%;
        margin-right: 1%;

        &.is--disabled {
            .filter--active:not([data-filter-param="reset"]),
            .filter--active:not([data-filter-param="reset"]):hover {
                color: @text-color;
                border-color: @border-color;
                cursor: default;

                .filter--active-icon {
                    color: @text-color;

                    &:before {
                        content: @sw-icon-check;
                    }
                }
            }
        }
    }

    .filter--actions {
        margin-left: 1%;
        margin-right: 1%;
    }

    .filter--btn-apply {
        width: auto;
    }

    .filter--facet-container,
    .filter--actions-bottom {
        display: none;
    }

    .filter--actions.filter--actions-top {
        display: none;
    }

    .listing--wrapper.has--sidebar-filter {

        .action--filter-btn {
            display:none;
        }

        .action--sort {
            .sort--select {
                .unitize(max-width, 200);
                vertical-align: top;
            }
        }
    }
}

@media screen and(min-width: @tabletLandscapeViewportWidth) {
    .filter-panel {
        width: 32%;
    }
}

@media screen and(min-width: @desktopViewportWidth) {

    .filter-panel--star-rating {
        .rating-star--input {
            .unitize-width(20);
            .unitize-height(20);
        }

        .rating-star--label {
            .unitize-width(20);
            .unitize-height(20);
            .unitize(line-height, 20);
            .unitize(font-size, 20);
        }
    }

    .listing--wrapper.has--sidebar-filter .action--sort .sort--label {
        .unitize-margin(0, 10, 0, 0);
        display: inline-block;
        font-weight: @font-bold-weight;
    }
}
